# @time     :2022/1/19
# @Author   :Simple
# @FileName :yaml
import os

import yaml

from config import BASE_CAPS_DIR
from util.logger import log as logger


def read_yaml(file):
    """
    read yaml file
    """
    if not os.path.exists(file):
        logger.warning("file not exists")
        raise FileNotFoundError
    with open(file, 'r', encoding="utf-8") as f:
        return yaml.full_load(f)


def get_base_caps():
    """
    get capabilities
    """
    base_caps = read_yaml(BASE_CAPS_DIR)
    return base_caps

